package com.ldc.framework.adapter

import com.ldc.commonlibs.listener.OnRowListener
import com.ldc.commonres.common.BaseRvAdapter
import com.ldc.commonres.common.BaseRvViewHolder
import com.ldc.framework.R
import com.ldc.framework.model.SystemModel

class SystemItemAdapter :
    BaseRvAdapter<SystemModel.SystemModelItem.Children>(R.layout.framework_layout_view_item_system2) {

    private var onRowListener: OnRowListener<SystemModel.SystemModelItem.Children>? = null
    fun addOnRowListener(onRowListener: OnRowListener<SystemModel.SystemModelItem.Children>?) {
        this.onRowListener = onRowListener
    }

    override fun convertTo(
        holder: BaseRvViewHolder,
        data: SystemModel.SystemModelItem.Children,
        position: Int
    ) {
        holder.setText(R.id.tv_name, data.name)
        holder.itemView.setOnClickListener {
            onRowListener?.onRow(it, data)
        }
    }
}